<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /*
        if

        switch
        */
        /*根据月份输出季节*/
        var monthstr = prompt("请输入月份:")
        /*
        prompt返回的结果就是用户再窗口上输入的值，以string类型返回
        */
        console.log(monthstr)
        console.log(typeof monthstr)
        //字符串转换为整数
        var month = Number.parseInt(monthstr)
        console.log(month)
        console.log(typeof month)
        if (month >= 3 && month <= 5) {
            console.log("春天")
        } else if (month >= 6 && month <= 8) {
            console.log("夏天")
        } else if (month >= 9 && month <= 11) {
            console.log("秋天")
        } else if (month == 12 || month == 1 || month == 2) {
            console.log("冬天")
        }

        if ('false') {  //只要字符串非空就判定为true
            console.log(true)
        } else {
            console.log(false)
        }

        if (new Object) {  //非空对象会判定为true
            console.log(true)
        } else {
            console.log(false)
        }

        if (1) {  //非零的number也会判断为true
            console.log(true)
        } else {
            console.log(false)
        }

        switch (month) {
            case 3:
            case 4:
            case 5:
                console.log("春天")
                break
            case 6:
            case 7:
            case 8:
                console.log("夏天")
                break
            case 9:
            case 10:
            case 11:
                console.log("秋天")
                break
            case 12:
            case 1:
            case 2:
                console.log("冬天")
                break
        }
    </script>
</head>

<body>

</body>

</html>